<include file="public@header" />
</head>
<body>
	<div class="wrap">
		<ul class="nav nav-tabs">
            <if condition="$type eq 'user'">
                <li><a href="{:url('AdminCategory/index')}">分类列表</a></li>
                <else/>
                <li><a href="{:url('AdminCategory/staff')}">员工分类列表</a></li>
            </if>
			
			<li class="active"><a href="{:url('AdminCategory/add')}">新增{$type=='staff'?'员工':''}分类</a></li>
        </ul>
        <if condition="$type eq 'user'">
            <form method="post" class="form-horizontal is-ajax-form margin-top-20" action="{:url('AdminCategory/addpost')}">
                <else/>
            <form method="post" class="form-horizontal is-ajax-form margin-top-20" action="{:url('AdminCategory/addStaffPost')}">
        </if>
        
			<div class="form-group">
				<label for="input-user_login" class="col-sm-2 control-label"><span class="form-required">*</span>名称</label>
				<div class="col-md-6 col-sm-10">
					<input type="text" class="form-control" id="input-name" name="post[name]">
				</div>
            </div>
            
			<div class="form-group">
				<div class="col-sm-offset-2 col-sm-10">
					<button type="submit" class="btn btn-primary js-ajax-submit">{:lang('ADD')}</button>
				</div>
			</div>
		</form>
	</div>
    <script src="__STATIC__/js/admin.js"></script>
    <script type="text/javascript">
        function getCity(province_id,province_name){
            console.log('getCity'+province_id,province_name)
            $("#province_name").attr("value", province_name)
            $.ajax({
                type: "GET",
                url:"{:url('Index/getCity')}",
                data:{
                    province_id:province_id
                },
                success:function(res){
                    console.log(res)
                    if(res['code']==1){
                        $("#choseCity").html('<option value="" >请选择 市县</option>')
    
                        var html = '',city=res['city'];
                        for(var i in city){
                            html+='<option value="'+city[i]['id']+'" name='+city[i]['name']+'>'+city[i]['name']+'</option>'
                        }
                        
                        $("#choseCity").append(html)
                        $("#choseCountry").html('<option value="" >请选择 地区</option>')
                    }
                }
            })
        }
        function getCountry(city_id,city_name){
            $("#city_name").attr("value", city_name)
    
            $.ajax({
                type: "GET",
                url:"{:url('Index/getCountry')}",
                data:{
                    city_id:city_id
                },
                success:function(res){
                    console.log(res)
                    if(res['code']==1){
                        $("#choseCountry").html('<option value="" >请选择 地区</option>')
    
                        var html = '',county=res['county'];
                        for(var i in county){
                            html+='<option value="'+county[i]['id']+'" name="'+county[i]['name']+'">'+county[i]['name']+'</option>'
                        }
                        $("#choseCountry").append(html)
                    }
                }
            })
        }
    
        function country(country_name){
            $("#country_name").attr("value", country_name)
        }
    </script>    
</body>
</html>